using Framework.Code.FlowWork;
using Microsoft.AspNetCore.Mvc;

namespace ApprovalFlow.Api.Controllers
{
    [ApiController]
    public class TestController : ControllerBase
    {

        private readonly ILogger<TestController> _logger;

        public TestController(ILogger<TestController> logger)
        {
            _logger = logger;
        }


        [HttpPost]
        [Route("api/Test/node")]

        public string addFlowChildNode([FromBody]FlowNode param)
        {
            var str = param.ToJson();
            _logger.LogInformation("param=====" + str);
            return "ok";
        }

        [HttpPost]
        [Route("api/Test/nodelist")]
        public string addFlowChildNodeList([FromBody]List<FlowNode> param)
        {
            var str = param.ToJson();
            _logger.LogInformation("list=====" + str);
            return "ok";
        }
        [HttpGet]
        [Route("api/Test/GetEnv")]
        public List<string> GetEnv()
        {
            var _config = GlobalConfig.SystemConfig.ToJson();
 
            var list = new List<string> { 
                _config,
                GlobalConfig.EnvironmentName
            };
            return list;
        }
    }
}